package com.navi.loaddata.core.mysqlEntity;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "spc_etl_error_data", schema = "ch_qms", catalog = "")
@IdClass(SpcEtlErrorDataPK.class)
public class SpcEtlErrorData {
    private String chartId;
    private String tabName;
    private String startSeq;
    private String endSeq;
    private Timestamp dbTimestamp;
    private String errorMessage;

    @Id
    @Column(name = "chart_id")
    public String getChartId() {
        return chartId;
    }

    public void setChartId(String chartId) {
        this.chartId = chartId;
    }

    @Id
    @Column(name = "tab_name")
    public String getTabName() {
        return tabName;
    }

    public void setTabName(String tabName) {
        this.tabName = tabName;
    }

    @Id
    @Column(name = "start_seq")
    public String getStartSeq() {
        return startSeq;
    }

    public void setStartSeq(String startSeq) {
        this.startSeq = startSeq;
    }

    @Id
    @Column(name = "end_seq")
    public String getEndSeq() {
        return endSeq;
    }

    public void setEndSeq(String endSeq) {
        this.endSeq = endSeq;
    }

    @Id
    @Column(name = "db_timestamp")
    public Timestamp getDbTimestamp() {
        return dbTimestamp;
    }

    public void setDbTimestamp(Timestamp dbTimestamp) {
        this.dbTimestamp = dbTimestamp;
    }

    @Basic
    @Column(name = "error_message")
    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SpcEtlErrorData that = (SpcEtlErrorData) o;

        if (chartId != null ? !chartId.equals(that.chartId) : that.chartId != null) return false;
        if (tabName != null ? !tabName.equals(that.tabName) : that.tabName != null) return false;
        if (startSeq != null ? !startSeq.equals(that.startSeq) : that.startSeq != null) return false;
        if (endSeq != null ? !endSeq.equals(that.endSeq) : that.endSeq != null) return false;
        if (dbTimestamp != null ? !dbTimestamp.equals(that.dbTimestamp) : that.dbTimestamp != null) return false;
        if (errorMessage != null ? !errorMessage.equals(that.errorMessage) : that.errorMessage != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = chartId != null ? chartId.hashCode() : 0;
        result = 31 * result + (tabName != null ? tabName.hashCode() : 0);
        result = 31 * result + (startSeq != null ? startSeq.hashCode() : 0);
        result = 31 * result + (endSeq != null ? endSeq.hashCode() : 0);
        result = 31 * result + (dbTimestamp != null ? dbTimestamp.hashCode() : 0);
        result = 31 * result + (errorMessage != null ? errorMessage.hashCode() : 0);
        return result;
    }
}
